<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html; charset=utf-8" import="com.*"%>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
	    <title>制卡批次信息录入</title>
	    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	    
	    <script src="${pageContext.request.contextPath }/scripts/boot.js" type="text/javascript"></script>
	    <style type="text/css">
    	
	    </style> 
  </head>
  
  <body>
   <form id="form1" method="post">
 	 <!-- ============================== 第一部分 制卡界面信息================================================== -->
 	 <fieldset style="border:solid 1px #aaa;width:97%;height: 100%;align:center;" >
 	 	<legend><span style="color:black;">制卡批次录入</span></legend>
 	    <div style="width:100%;">
 	    	<table style="width:100%;" cellpadding="5">
 	    		<tr style="width:100%;">
 	    			<td style="width:30%;text-align:right;">制卡批次:</td>
 	    			<td style="width:70%;"><input id="aaz001" name="aaz001" vtype="minLength:10" maxLength="10" class="mini-textbox" emptyText="请输入10位制卡批次，以GR或DW开头" style="width:60%;" required="true" maxLength="10"/></td>
 	    		</tr>
 	    		<tr style="width:100%;">
 	    			<td style="width:30%;text-align:right;">生效时间:</td>
 	    			<td style="width:70%;"><input id="aaz707" name="aaz707" allowInput="false" class="mini-datepicker"  style="width:60%;" emptyText="请输入生效时间" required="true" ondrawdate="onDrawDate" vtype="date:yyyy-MM-dd" maxLength="8"/></td>
 	    		</tr>
 	    		<tr style="width:100%;">
 	    			<td style="width:30%;text-align:right;">领取时间:</td>
 	    			<td style="width:70%;"><input id="aaz708" name="aaz708" class="mini-datepicker" allowInput="false" style="width:60%;" emptyText="请输入领取时间" required="true" ondrawdate="onDrawDate" vtype="date:yyyy-MM-dd" maxLength="8"/></td>
 	    		</tr>
 	    		<tr style="width:100%;">
 	    			<td style="width:30%;text-align:right;">是否特殊批次:</td>
 	    			<td style="width:70%;"><input id="aaz719" name="aaz719" class="mini-combobox" 
 	    									data="[{id: 1, text: '是'}, {id: 2, text: '否'}]" style="width:60%;" emptyText="请选择标识" required="true"/></td>
 	    		</tr>	   		 	    		
 	    	</table>
 	    </div>
 	 </fieldset>
 	
 	 <!-- ============================== 第三部分 按钮================================================== -->
 	 <br/>
	    <div>
	    	<table style="table-layout:fixed;width:100%;" cellpadding="0" cellspacing="10">
	    		<tr style="width:100%;">
	    		 <td style="width:44%;white-space:nowrap;"></td>
			     <td style="width:6%;white-space:nowrap;"><a class="mini-button"  id="onoks" name="onoks" onclick="onOk"  style="width:100%;" iconCls="icon-ok">确认</td>
			     <td style="width:6%;white-space:nowrap;"><a class="mini-button"  onclick="onReset"  style="width:100%;" iconCls="icon-remove">重置</td>
			     <td style="width:44%;"></td>
	    		</tr>
	    	</table>
	    </div> 
   </form> 
   
   <script type="text/javascript">
   		mini.parse();
   		var form = new mini.Form("form1");
   		var today = new Date();
   		/* var now = today.getFullYear() + "-" +today.getMonth() +"-"+ today.getDay(); */
        mini.getbyName("aaz402").setValue(today);
        
   		function SaveData() {
            var o = form.getData();
            form.validate();
            if (form.isValid() == false) {
            	return;
           }
            var aaz001 = mini.getbyName("aaz001").getValue().trim();
            
        	var flag = aaz001.substring(0,2);
        	if(flag != 'GR' && flag != 'DW'){
        		mini.alert("请输入以GR或者DW开头的十位制卡批次！");
        		return ;
        	}
        	
            var b = mini.get("#aaz707").getFormValue();
			var c = mini.get("#aaz708").getFormValue();	
			
			if(b > c){
				mini.alert("生效时间不得大于领取时间！");
				return false;
			}
            if(form.isValid()==true){
      	    	mini.mask({el: document.body,cls: 'mini-mask-loading',html: '保存中...'});     	             	   
           var json = mini.encode([o]);
           $.ajax({
                  url: "${pageContext.request.contextPath}/AZ10.do?method=saveAZ10",
                  type: 'post',
                  data: { data: json},
                  cache: false,
                  success: function (text) {
                	mini.unmask();
                	mini.alert(text);               	
                  },
                  error: function (jqXHR, textStatus, errorThrown) {
                    alert(jqXHR.responseText);
                    CloseWindow();
                  }
              });
        }
         }
        function onDrawDate(e) {
            var date = e.date;
            var d = new Date();

            if (date.getTime() < d.getTime()) {
                e.allowSelect = false;
            }
        }
   		
   		function onOk(e) {
             SaveData();
        }
   		
   		function onReset(e) {  			
        	 form.clear();
    	}
    	
    	 function upper(){
    		var aaz001 = mini.getbyName("aaz001").getValue().trim();
    	    aaz001 = aaz001.toUpperCase();
    	} 
   </script>
   
  </body>
</html>
